package com.cby.android.sample

import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import com.airbnb.lottie.LottieAnimationView
import com.cby.android.library.base.BaseActivity
import com.cby.android.olive.ext.start

/**
 * @description: LaunchActivity
 * @author: ChenBaoYang
 * @createDate: 2022/4/26 5:33 下午
 */
class LaunchActivity : BaseActivity() {


    private val lottieView: LottieAnimationView? by lazy { findViewById(R.id.lav_splash_lottie) }

    override fun getLayoutId() = R.layout.activity_launch

    override fun onViewInit() {
        // 设置动画监听
        lottieView?.addAnimatorListener(object : AnimatorListenerAdapter() {
            override fun onAnimationEnd(animation: Animator?) {
                lottieView?.removeAnimatorListener(this)
                start(MainActivity::class.java)
                finish()
            }
        })
    }

    override fun onDataInit() {
    }
}